var windowName = "userPicker";
var list = new List();
var Page
apiready = function(){
    onWindowShow(function () {
    })
    onWindowHide(function () {
    })
    console.log("index page is OK");
    Page = createVM("#Page",{
        //页面数据
        list:[]
        ,curUser:{}
    },{
        //页面方法
        "init":function () {
            // showLoading()
            // getCurFile(this)
            var cur = getLocData("curUser")
            this.curUser = cur;

            list.setUrl("/app/users")
                .setCbFunc(function (data) {
                    stopPullUpLoadMore()
                    stopPullDownRefresh()
                    Page.list = data
                    log(data)
                }).getList();

        },
        'setCurFile': function (index) {
            setLocData("curUser",this.list[index])
            this.curUser = this.list[index];
            goback()
        }
        , OnPullDownRefresh: function () {
            startPullDownRefresh();
            list.reload();
        }
        , OnPullUpLoadMore: function () {
            startPullUpLoadMore();
            list.getList()
        }
    })

    Page.init()

}
function getCurFile(_this) {
    apiLoad("/app/file/list",{},function (res) {
        logHtml(res)
        _this.list = res.data
    })
}